﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace VocabManager.Model
{
    public class Item
    {
        public int Id
        {
            get;
            set;
        }
        public int DeckId
        {
            get;
            set;
        }
        public Item(FrontPart frontPart, BackPart backPart)
        {
            _front = frontPart;
            _back = backPart;
            _title = string.Empty;
        }


        public DateTime CreationTime
        {
            get;
            set;
        }
        public DateTime LastModificationTime { get; set; }
        string _title;
        public string Title
        {
            get
            {
                return string.IsNullOrEmpty(_title) ? _front.Text : _title;
            }

        }

        FrontPart _front;
        BackPart _back;
        public FrontPart Front
        {
            get
            {
                return _front;
            }
        }
        public BackPart Back
        {
            get
            {
                return _back;
            }
        }


        internal static Item CreateNew()
        {
            return new Item(new FrontPart(), new BackPart()) { Id = -1 };
        }
    }
}
